<template>
	<view class="container">
		<view class="header-wrap">
			<text class="title">商户列表</text>
			<view class="filter" @tap="onOpen">
				<uni-icons type="settings" size="24"></uni-icons>
				<text>筛选</text>
			</view>
		</view>

		<view class="content-wrap">
			<view class="item" v-for="item in vdata.mchStarList">
				<text class="no">商户号：{{ vdata.queryParams.mchNo }}</text>
				<view class="line"></view>
				<text class="title">商户名：{{ vdata.queryParams.mchNo }}</text>


				<view class="number">
					<text class="time">星级归属月份：{{ dayjs(item.businessMonth).format('M') }} 月</text>
					<view class="info">
						<uni-icons type="star-filled" color="#fff"></uni-icons>
						新进件
					</view>
					<view class="info" style="margin-left: 12rpx;">
						<uni-icons type="star-filled" color="#fff"></uni-icons>
						{{ item.satr }}
					</view>
				</view>
			</view>
		</view>

		<gzListNull :list="vdata.mchStarList"></gzListNull>

		<uni-popup ref="searchPopup" type="top">
			<view class="popup-content">
				<view class="item">
					<text>商户号</text>
					<input class="input" placeholder-style="color:#BBBBBB" placeholder="请输入商户号" v-model="vdata.queryParams.mchNo" />
				</view>
				<view class="bottom-wrap">
					<text class="reset" @click="()=>vdata.queryParams={}">重置</text>
					<text class="query" @click="onQuery">查询</text>
				</view>
			</view>
		</uni-popup>

	</view>
</template>

<script setup>
	import dayjs from 'dayjs'
	import { ref, reactive } from 'vue'
	import { onReady, onLoad } from '@dcloudio/uni-app'
	import { $mchStar } from '@/http/marketing/apiMarketing.js'
	// 搜索弹框
	const searchPopup = ref(0)
	// 数据源
	const vdata = reactive({
		queryParams: {},
		mchStarList: [], // 商户星级列表
	})
	onReady(() => {
		// 默认弹窗打开
		onOpen()
	})
	/**
	 * 打开弹窗
	 */
	const onOpen = () => {
		searchPopup.value.open();
	}
	/**
	 * 关闭弹窗
	 */
	const onClose = () => {
		searchPopup.value.close();
	}
	/**
	 * 查询商户星级
	 */
	function onQuery() {
		getMchStar(vdata.queryParams.mchNo)
		onClose()
	}
	/**
	 * 获取商户星级
	 */
	function getMchStar(mchNo) {
		$mchStar({ mchNo }).then(({ bizData }) => {
			vdata.mchStarList = bizData || []
		})
	}
	const contentList = [{
		no: "LKLDLKWDL1001",
		title: '大连万达集团',
		time: '5月',
		no1: 210,
		no2: 1000,
		price: 123
	}, {
		no: "LKLDLKWDL1001",
		title: '大连万达集团',
		time: '5月',
		no1: 210,
		no2: 1000,
		price: 123
	}, {
		no: "LKLDLKWDL1001",
		title: '大连万达集团',
		time: '5月',
		no1: 210,
		no2: 1000,
		price: 123
	}, ]
</script>

<style lang="less">
	@page-backgroud: #F6F7FC; //页面背景色

	page {
		background: @page-backgroud;
	}

	.container {
		min-height: 100vh;
		padding: 30rpx 20rpx 30rpx 20rpx;
		box-sizing: border-box;
		overflow: hidden;

		.header-wrap {
			width: 100%;
			position: fixed;
			height: 120rpx;
			top: 0;
			left: 0;
			display: flex;
			justify-content: space-between;
			align-items: center;
			z-index: 2;
			box-sizing: border-box;
			padding: 0 30rpx;
			background-color: @page-backgroud;

			.title {
				font-weight: bold;
				font-size: 32rpx;
				color: #333333;
				font-style: normal;
				flex-grow: 1;
			}


			.filter {
				display: flex;
				align-items: center;
				border-radius: 40rpx;
				background-color: white;
				padding: 8rpx 20rpx;
				border: 1rpx solid #C8C8C8;

				text {
					font-size: 26rpx;
					color: black;
					letter-spacing: 1px;
					margin-bottom: 2rpx;
				}
			}

		}

		.content-wrap {
			width: 100%;
			margin-top: 100rpx;
			position: relative;
			z-index: 0;

			.item {
				box-sizing: border-box;
				padding: 30rpx;
				background: #fff;
				border-radius: 20rpx;
				box-shadow: 0rpx -10rpx 30rpx -30rpx rgba(0, 0, 0, 0.8);
				display: flex;
				flex-direction: column;
				margin-bottom: 30rpx;


				.no {
					font-size: 26rpx;
					color: #333333;
				}

				.line {
					height: 1rpx;
					background-color: #E6E6E6;
					margin: 20rpx 0rpx;
				}

				.title {
					font-weight: bold;
					font-size: 32rpx;
					color: #333333;
					margin: 15rpx 0rpx;
				}

				.number {
					display: flex;
					align-items: center;
					color: darkgray;
					font-size: 26rpx;
					margin: 5rpx 0rpx;

					.total-num {
						margin-right: 50rpx;
					}

					.time {
						flex-grow: 1;
					}

					.info {
						// border: 1rpx solid #C8C8C8;
						border-radius: 35rpx;
						// background-color: white;
						padding: 15rpx 30rpx;
						color: #fff;
						box-shadow: 0rpx -10rpx 30rpx -30rpx rgba(0, 0, 0, 0.8);

						&:nth-of-type(1) {
							background: linear-gradient(to right, #FDD61D, #FBC92C);
						}

						&:nth-of-type(2) {
							background: linear-gradient(to right, #34D387, #24C789);
						}
					}
				}

			}
		}

		.popup-content {
			display: flex;
			flex-direction: column;
			align-items: center;
			padding: 40rpx 30rpx;
			font-size: 26rpx;
			background-color: white;
			border-radius: 0 0 20rpx 20rpx;
			letter-spacing: 1px;
			box-sizing: border-box;
			margin-top: 120rpx;

			.item {
				display: flex;
				flex-direction: column;
				font-size: 28rpx;
				margin-bottom: 30rpx;
				width: 100%;

				.input {
					border-radius: 40rpx;
					padding: 18rpx 30rpx;
					background-color: #F6F7FC;
					margin-top: 20rpx;
					font-size: 30rpx;
				}

			}


			.bottom-wrap {
				display: flex;
				flex-direction: row;
				align-items: center;
				font-size: 30rpx;
				margin-top: 30rpx;
				margin-bottom: 10rpx;
				width: 100%;

				.reset {
					color: black;
					border-radius: 40rpx;
					width: 25%;
					padding: 18rpx 0rpx;
					background-color: #F4F5F5;
					text-align: center;
					margin-right: 30rpx;
				}

				.query {
					color: white;
					border-radius: 40rpx;
					width: 75%;
					padding: 18rpx 0rpx;
					background-color: #24C789;
					margin-top: 30rpx;
					text-align: center;
					margin-bottom: 10rpx;
				}
			}

		}

	}
</style>